﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TR.AppService.Dto;
using TR.Domain.Entity.BsItemType;
using TR.Domain.Entity;
using TR.Domain.Repository.BsItemRepository;
using TR.Domain.Repository.sqlDto;
using static System.Net.Mime.MediaTypeNames;

namespace TR.AppService.AppService.Bs_Item
{
    public class Bs_ItemService:IBs_ItemService
    {
        private readonly IItemIRepository iitemIRepository;
        private readonly IMapper mapper;
        public Bs_ItemService(IItemIRepository iitemIRepository, IMapper mapper)
        {
            this.iitemIRepository = iitemIRepository;
            this.mapper = mapper;
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        public Task<List<bs_Item>> ItemSelete()
        {
            return iitemIRepository.ItemSelete();
        }
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="Item"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Task<bool> ItemAdd(bs_Item addItemDao)
        {
            bs_Item bs = mapper.Map<bs_Item>(addItemDao);
            return iitemIRepository.ItemAdd(bs);
        }
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="currentPage"></param>
        /// <param name="str"></param>
        /// <returns></returns>
        public Task<FenYe<bs_Item>> bs_Item_FenYe(int pageSize, int currentPage, string str)
        {
            return iitemIRepository.bs_Item_FenYe(pageSize, currentPage, str);
        }
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="currentPage"></param>
        /// <param name="str"></param>
        /// <returns></returns>
        public Task<FenYe<wh_orderbuy_d>> wh_Orderbuy_d_FenYe(int pageSize, int currentPage, string str)
        {
            return iitemIRepository.wh_Orderbuy_d_FenYe(pageSize, currentPage, str);
        }
        /// <summary>
        /// 新增查询
        /// </summary>
        /// <param name="pageSize"></param>
        /// <param name="currentPage"></param>
        /// <param name="str"></param>
        /// <returns></returns>
        public Task<FenYe<bs_Item>> bs_Item_xz_FenYe(int pageSize, int currentPage, string str)
        {
            return iitemIRepository.bs_Item_xz_FenYe(pageSize, currentPage, str);
        }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="item_code"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<bool> ItemUDelect(string item_code)
        {
            return await iitemIRepository.ItemUDelect(item_code);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<bool> ItemDelect(int id)
        {
            return await iitemIRepository.ItemDelect(id);
        }
        /// <summary>
        /// 查询id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Task<bs_Item> ItemSelectid(int id)
        {
            return iitemIRepository.ItemSelectid(id);
        }
        public Task<bs_Item> ItemSelectCode(string item_code)
        {
            return iitemIRepository.ItemSelectCode(item_code);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="usd"></param>
        /// <returns></returns>
        public Task<bool> ItemUpdate(UpdateItemDto uid)
        {
            return iitemIRepository.ItemUpdate(uid);
        }

        Task<FenYe<wh_orderbuy_d>> IBs_ItemService.wh_Orderbuy_d_FenYe(int pageSize, int currentPage, string str)
        {
            return iitemIRepository.wh_Orderbuy_d_FenYe(pageSize, currentPage, str);
        }

       /* public Task<ItemImage> UploadImageAsync(int parentId, string fileName, string imageUrl)
        {
            throw new NotImplementedException();
        }*/
        //上传图片
    }
}
